package com.springboot.shiro.conf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * Created by pactera on 2019/4/23.
 */
@Component
@ConfigurationProperties
public class ApplicationProperties {

    @Autowired
    private Environment environment;



    private String shiroRedisHost;
    private int shiroRedisPort;
    private int shiroRedisDataBase;


    private int shiroRedisTimeout;


    public int getShiroRedisPort() {
        return Integer.valueOf(environment.getProperty("spring.redis.port"));
    }

    public int getShiroRedisDataBase() {
        return Integer.valueOf(environment.getProperty("spring.redis.database"));
    }

    public String getShiroRedisHost() {
        return environment.getProperty("spring.redis.host");
    }

    public int getShiroRedisTimeout() {
        return Integer.valueOf(environment.getProperty("shiro.redis.timeout"));
    }
}
